package com.btks.mapreduce.outputformat;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @author yiwannuofulasi
 * @description Reducer阶段也不做任何处理（v，NullWritable）
 * @date 2023/3/27 11:19
 * Copyright (c) 2023/3/27 by yiwannuofulasi yiwannuofulasi@163.com, by 新疆兵团勘测设计院（集团）有限公司 All Rights Reserved.
 */
public class LogReducer extends Reducer<Text, NullWritable, Text,NullWritable> {
    @Override
    protected void reduce(Text key, Iterable<NullWritable> values, Reducer<Text, NullWritable, Text, NullWritable>.Context context) throws IOException, InterruptedException {
        // http://www.baidu.com
        // http://www.google.com
//        context.write(key,NullWritable.get());
        // 防止有相同的数据（丢数据）
        for (NullWritable value : values) {
            context.write(key,value);
        }
    }
}
